package com.example.filestorage.starter;

import com.example.filestorage.starter.config.MinioConfig;
import com.example.filestorage.starter.service.FileStorageService;
import com.example.filestorage.starter.service.MinioStorageService;
import com.example.filestorage.starter.service.RustFsStorageService;
import com.example.filestorage.starter.service.StorageManagerService;
import io.minio.MinioClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

import java.util.List;

@Configuration
@EnableConfigurationProperties(FileStorageProperties.class)
@Import({MinioConfig.class, MinioStorageService.class, RustFsStorageService.class, StorageManagerService.class})
public class FileStorageAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public FileStorageService fileStorageService(StorageManagerService storageManagerService) {
        return new FileStorageService(storageManagerService);
    }
}